<?php header("Content-Type:text/html;   charset=utf-8"); ?>
<script type="text/javascript">
	$(function(){
		loadAdmin();		
		$("#btnQueryAdmin").bind("click",loadAdmin);
		$("#hrefDelAdmin").bind("click",delSelectAdmin);
		$("#hrefAddAdmin").bind("click",addAdmin);						
	});	
	function delSelectMultiAdmin(ids){
		var params={ids:ids};
 	 	var url="admin.php/manage/delAdmin";
 	 	$.ajax({
 	 	 	type:"post",
 	 	 	url:url,
 	 	 	dataType:"json",
 	 	 	data:params,
 	 	 	success:function(data){
 	 	 	 	
				if(data.ReturnCode=="1"){
					loadAdmin();
					alert('删除成功');
				}else{
					alert('删除失败');
				}
 	 	 	}
 	 	});
	}
 	function delSelectAdmin(){
 	 	var selIds=getSelectIdsAdmin();
 	 	if(selIds==""){
 	 	 	alert('请选择要删除的项');
 	 	 	return;
 	 	}
 	 	if(confirm('删除后不可恢复，确认要删除吗？')==false)
 	 	 	return; 	
 	 	delSelectMultiAdmin(selIds);	
 	}
 	function delAdmin(id){
 	 	if(confirm('确定要删除吗？')==false)
 	 	 	return;
 	 	delSelectMultiAdmin(id);
 	}
 	
	function getSelectIdsAdmin(){
		var sel = "";
		$("#tableAdmin td :checkbox:checked").each(function(){
			sel+=$(this).val()+",";
		});
		return sel;
	}		
	function loadAdmin(){
		$("#chkSelectAllAdmin").attr("checked",false);		
		var url="admin.php/manage/loadAdmin";
		$.ajax({
			type:"post",
			url:url,
			dataType:"html",			
			success:function(data){
				$("#tableAdmin").html(data);
				bindSelect("chkSelectAllAdmin","tableAdmin");				
			}
		});	
	}
	function modifyAdmin(id){		
		$("#hrefEditAdmin").attr("href","admin.php/manage/newAdmin?id="+id);
		$("#hrefEditAdmin").trigger("click");
	}
	function addAdmin(){
		$("#hrefEditAdmin").attr("href","admin.php/manage/newAdmin");
		$("#hrefEditAdmin").trigger("click");
	}
	function setAdminDefault(id){
		var params = {ids:id};
		$.ajax({
			type:"post",
			url:"admin.php/manage/setDefault",
			dataType:"json",
			data:params,
			success:function(data){
				if(data.ReturnCode==1){
					loadAdmin();
					alert("操作成功");
				}
			}
		});
	}
</script>

<div class="pageHeader">
	<form>
		<div class="searchBar">
			<table class="searchContent">
				<tr>
					<td>
						<div class="subBar">
							<ul>
								<li><div class="buttonActive">
										<div class="buttonContent">
											<button id="btnQueryAdmin" type="button" style="width: 100px">查&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;询</button>
										</div>
									</div></li>
							</ul>
						</div>
					</td>
				</tr>
			</table>

		</div>
	</form>
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<li style="display: none"><a id="hrefEditAdmin" class="edit" href=""
				lookupgroup="orgLookup"><span>修改</span></a></li>
			<li><a id="hrefAddAdmin" class="add" href="javascript:void(0)"><span>添加管理员</span></a></li>
			<li><a id="hrefDelAdmin" class="delete" href="javascript:void(0)"><span>删除</span></a></li>
		</ul>
	</div>
	<table class="table" width="100%" layoutH="138">
		<thead>
			<tr>
				<th style='width: 30px; text-align: center;'><input type='checkbox'
					id='chkSelectAllAdmin' /></th>
				<th style='width: 40px'>编号</th>
				<th style='width: 120px'>管理员账号</th>
				<th style='width: 100px'>状态</th>
				<th style='width: 100px'>最后登录时间</th>
				<th style='width: 100px'>最后登录IP</th>				
				<th style='width: 120px'>操作</th>

			</tr>
		</thead>
		<tbody id="tableAdmin">

		</tbody>
	</table>
</div>





























